<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    {{ msg | capitalize | reverseMsg }}
  
  </div>
  <script src="./vue.js"></script>
  <script>
    // 全局过滤器 
    Vue.filter('capitalize', (v)=>{
     let letter = v.charAt(0);
     letter = letter.toUpperCase();
    
      return letter + v.substr(1)
    })
    Vue.filter('reverseMsg', (v)=>{
      return v.split('').reverse().join('')
    })
    const vm = new Vue({
      el: '#app',
      data: {
        msg: 'hello'
      },
      filters:{
        capitalize: (v)=>{
          return v.toUpperCase()
        }
      }
    })
  </script>
</body>
</html>